import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: "/login",
    name: "Login",
    component: () =>
      import("../views/Login.vue"),
    meta: { title: '系统首页' },
  },
  {
    path: "/home",
    name: "Home",
    component: () =>
      import("../views/Home.vue"),
    meta: { title: '系统首页' },
    children: [
      {
        path: "/",
        redirect: "/index"
      },
      {
        path: "/index",
        name: "Index",
        meta: { title: '系统首页' },
        component: () =>
          import("../views/index.vue"),
      },
      {
        path: "/productList",
        name: "ProductList",
        meta: { title: '商品管理' },
        component: () =>
          import("../views/ProductList.vue")
      },
      {
        path: "/userManage",
        name: "UserManage",
        meta: { title: '员工管理' },
        component: () =>
          import("../views/UserManage.vue")
      },
      {
        path: "/permissions",
      }
    ]
  }
];

const router = new VueRouter({
  mode: "history",
  routes
});

export default router;
